package xiaohu.day5.HJ52;

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String str1 = in.nextLine();
            String str2 = in.nextLine();
            int[][] dp = new int[str1.length()+1][str2.length()+1];
            //初始化
            for (int i = 0; i <= str1.length(); i++) {
                dp[i][0] = i;
            }
            for (int j = 0; j <= str2.length(); j++) {
                dp[0][j] = j;
            }
            for (int i = 1; i <= str1.length(); i++) {
                for (int j = 1; j <=str2.length(); j++) {
                    if (str1.charAt(i-1) == str2.charAt(j-1)) {
                        dp[i][j] = dp[i - 1][j - 1];
                    }else {
                        dp[i][j] = Math.min(Math.min(dp[i - 1][j], dp[i][j - 1]),dp[i - 1][j - 1])+1;
                    }
                }
            }
            System.out.println(dp[str1.length()][str2.length()]);
        }
    }
}